package com.demo.account.service.impl;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.demo.account.api.AccountApi;
import com.demo.account.mapper.auto.AccountMapper;
import com.demo.account.model.AccountVO;
import com.demo.account.util.AccountToVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;

import java.util.List;

/**
 * @author wuyijie
 * @className: AccountApiImpl
 * @description: TODO
 * @date 2021/3/30 13:38
 */
@DubboService
@Slf4j
public class AccountApiImpl implements AccountApi {
    @Autowired
    private AccountMapper accountMapper;

    @Value("${name}")
    private String name;

    @Override
    @SentinelResource(value = "accountservice#getById")
    public AccountVO getById(int id) {
        log.info("AccountApiImpl#getById name= {}",name);
        return AccountToVo.accountToVo(accountMapper.selectById(id));
    }

    @Override
    public List<AccountVO> listAccount() {
        return null;
    }
}
